#!/usr/bin/php
<?php
$row="";
$header="";

while($line = fgets(STDIN)) {
  if(substr($line,0,2) == "--") {
    if($header) $header .= ",";
    $header .= trim($line,"- \n\r");
    continue;
  }
  if(strpos($line,'rows') === false) continue;

  $line = explode('(',$line,2);
  $line = $line[1];
  $int = substr($line,0,strpos($line,')')-1);
  $int = explode(',',$int);
  $int = round(trim($int[0],'s '),3);
  $row .= $int . ",";
}
$row=trim($row,',');
echo $header . "\n";
echo trim($row) . "\n";

